/* 个人中心样式文件 */

/* 个人中心布局 */
.profile-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 24px;
}

.profile-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.edit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    color: #6B7280;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn:hover {
    background: #E5E7EB;
    color: #374151;
}

/* 头像区域 */
.avatar-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.avatar-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #F0F4F9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    color: #A0AEC0;
    text-align: center;
}

.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.avatar-container:hover .avatar-overlay {
    opacity: 1;
}

.avatar-upload-btn {
    color: #FFFFFF;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.2s;
}

.avatar-upload-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.avatar-info {
    flex: 1;
}

.user-name {
    font-size: 20px;
    font-weight: 600;
    color: #1F2937;
    margin: 0 0 4px 0;
}

.user-role {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

/* 表单样式 */
.info-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-input {
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: #FFFFFF;
}

.form-input:focus {
    outline: none;
    border-color: #2A5CAA;
    box-shadow: 0 0 0 3px rgba(42, 92, 170, 0.1);
}

.form-input[readonly] {
    background: #F9FAFB;
    color: #6B7280;
}

/* 下拉框特殊样式 */
.form-input[type="select"],
.form-input select,
select.form-input {
    position: relative;
    z-index: 1;
    /* 确保下拉框有足够的宽度 */
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* 确保下拉选项不会超出父容器 */
.form-input option {
    background: #FFFFFF;
    color: #1F2937;
    padding: 8px 12px;
    /* 处理长文本 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 为下拉框容器添加相对定位，确保下拉选项正确定位 */
.form-group {
    position: relative;
}

/* 修复下拉框在网格布局中的显示问题 */
.form-row .form-group {
    overflow: visible;
}

/* 确保下拉选项有足够的空间显示 */
.form-input[multiple],
.form-input[size] {
    max-height: 200px;
    overflow-y: auto;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.save-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #2A5CAA;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.save-btn:hover {
    background: #1e4788;
}

.cancel-btn {
    padding: 10px 20px;
    background: #F3F4F6;
    color: #6B7280;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: #E5E7EB;
    color: #374151;
}

/* 竞赛统计 */
.competition-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.recent-competitions {
    margin-top: 24px;
}

.competition-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.competition-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #F9FAFB;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
}

.competition-info {
    flex: 1;
}

.competition-name {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
    margin: 0 0 4px 0;
}

.competition-date {
    font-size: 12px;
    color: #6B7280;
    margin: 0;
}

.result-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.result-badge.winner {
    background: #DEF7EC;
    color: #03543F;
}

.result-badge.runner-up {
    background: #FEF3C7;
    color: #92400E;
}

/* 简历上传 */
.resume-section {
    margin-top: 16px;
}

.upload-area {
    border: 2px dashed #E5E7EB;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #F9FAFB;
}

.upload-area:hover {
    border-color: #2A5CAA;
    background: #F0F9FF;
}

.upload-area.drag-over {
    border-color: #2A5CAA;
    background: #F0F9FF;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(42, 92, 170, 0.15);
}

.upload-icon {
    color: #9CA3AF;
    margin-bottom: 16px;
}

.upload-text {
    margin-bottom: 8px;
}

.upload-text p {
    margin: 0 0 8px 0;
    color: #6B7280;
}

.upload-link {
    color: #2A5CAA;
    font-weight: 500;
    cursor: pointer;
}

.upload-hint {
    font-size: 12px;
    color: #9CA3AF;
}

.resume-info {
    margin-top: 16px;
    padding: 20px;
    background: #F9FAFB;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resume-info:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border-color: #D1D5DB;
}

.resume-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #E5E7EB;
}

.resume-file {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.resume-file iconify-icon {
    color: #2A5CAA;
    background: #E0E7FF;
    padding: 8px;
    border-radius: 6px;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
}

.delete-resume-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #EF4444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
    animation: fadeInRight 0.5s ease-out;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.delete-resume-btn:hover {
    background: #DC2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.delete-resume-btn:active {
    transform: translateY(0);
}

.delete-resume-btn:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 删除按钮的加载状态 */
.delete-resume-btn.loading {
    background: #9CA3AF;
    cursor: not-allowed;
    pointer-events: none;
}

.delete-resume-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.file-size {
    font-size: 13px;
    color: #6B7280;
    margin: 0;
    padding: 8px 12px;
    background: #F3F4F6;
    border-radius: 4px;
    border-left: 3px solid #2A5CAA;
}

.view-all-btn {
    padding: 8px 16px;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    color: #6B7280;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-all-btn:hover {
    background: #E5E7EB;
    color: #374151;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .profile-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .competition-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .avatar-section {
        flex-direction: column;
        text-align: center;
    }
}

/* 下拉框溢出修复 */
@media (max-width: 1200px) {
    .form-row .form-group {
        overflow: visible;
    }
    
    /* 确保在小屏幕上下拉选项不会超出视口 */
    .form-input option {
        max-width: 100%;
        word-wrap: break-word;
    }
}

/* 消息提示样式 */
.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-toast.show {
    transform: translateX(0);
}

.message-toast.success {
    background: linear-gradient(135deg, #10B981, #059669);
}

.message-toast.error {
    background: linear-gradient(135deg, #EF4444, #DC2626);
}

.message-toast.info {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
}
